DynamicCustomTool: DB metadata based parameter support#3601
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds DB-metadata-based parameter validation and per-parameter default application for MCP stored-procedure tools, addressing scenarios where parameters are discovered only via DB metadata and defaults should apply only to missing params.
Changes:
- Validate user-supplied parameters against
StoredProcedureDefinition.Parameters(DB metadata) inExecuteEntityToolandDynamicCustomTool. - Apply config defaults per missing parameter using
ParameterDefinition.HasConfigDefault/ConfigDefaultValue. - Add/extend unit + MSSQL integration tests and enable MCP custom tools in MSSQL config generator commands.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Azure.DataApiBuilder.Mcp/Core/DynamicCustomTool.cs | Switches validation/defaulting to DB metadata definitions. |
| src/Azure.DataApiBuilder.Mcp/BuiltInTools/ExecuteEntityTool.cs | Same validation/defaulting changes for the built-in execute tool. |
| src/Service.Tests/Mcp/ExecuteEntityToolTests.cs | New unit tests covering validation/default application + gating. |
| src/Service.Tests/Mcp/ExecuteEntityToolMsSqlIntegrationTests.cs | New end-to-end MSSQL integration tests for execute tool behavior. |
| src/Service.Tests/Mcp/DynamicCustomToolTests.cs | Adds execution-time unit tests for DynamicCustomTool behavior. |
| src/Service.Tests/Mcp/DynamicCustomToolMsSqlIntegrationTests.cs | New MSSQL integration tests for DynamicCustomTool behavior. |
| config-generators/mssql-commands.txt | Enables --mcp.custom-tool true for stored-procedure entities used by tests. |
Aniruddh25
reviewed
May 19, 2026
Aniruddh25
reviewed
May 20, 2026
Aniruddh25
reviewed
May 20, 2026
Aniruddh25
reviewed
May 20, 2026
Aniruddh25
reviewed
May 20, 2026
Aniruddh25
approved these changes
May 20, 2026
Collaborator
Aniruddh25
left a comment
There was a problem hiding this comment.
Approving with suggestions on fixing the tests, and few questions.
Contributor
|
The snapshot file needs to be updated; I am approving this PR to prevent any blockers from my side. |
anushakolan
approved these changes
May 20, 2026
Contributor
Author
|
waiting for #3600 to merge as this was branched out from that with related fixes. |
# Conflicts: # src/Service.Tests/Mcp/ExecuteEntityToolTests.cs
Aniruddh25
approved these changes
May 20, 2026
aaronburtle
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why make this change?
DynamicCustomTool (per-entity custom MCP tools) used
entityConfig.Source.Parameters/ParameterMetadatafor parameter validation and defaults. This meant:What is this change?
dbObjecttoDatabaseStoredProcedureand validate user-supplied params againstspDefinition.Parameters(source of truth populated byFillSchemaForStoredProcedureAsync).spDefinition.Parameters; for each missing param withHasConfigDefault == true, injectConfigDefaultValue. User-supplied params always take precedence.entityConfig.Source.Parameters/ParameterMetadataloop.How was this tested?
AcceptsDbDiscoveredParamRejectsInvalidParamName(x2)AppliesConfigDefaultsHasConfigDefault/ConfigDefaultValueUserParamsOverrideDoesNotInjectWithoutDefaultHasConfigDefaultis not injectedZeroParamSPGetBookById_ReturnsRecordSample Request(s)
NA